<?php

namespace common\models\wechat;

use Yii;

/**
 * This is the model class for table "wechat_music_reply".
 *
 * @property string $id
 * @property string $rid
 * @property string $title
 * @property string $description
 * @property string $url
 * @property string $hqurl
 */
class WechatMusicReply extends \yii\db\ActiveRecord
{


    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '音乐回复',      //用于修改了什么的显示
        'mainfield' => 'title',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'wechat_music_reply';
    }




    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['rid', 'title', 'description', 'url', 'hqurl'], 'required'],
            [['rid'], 'integer'],
            [['title'], 'string', 'max' => 50],
            [['description'], 'string', 'max' => 255],
            [['url', 'hqurl'], 'string', 'max' => 300],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'rule' => '规则名称',
            'keyword' => '关键字',
            'title' => '音乐标题',
            'description' => '简述',
            'url' => '音乐链接',
            'hqurl' => '高品质链接',
        ];
    }


    /**
     * @return \yii\db\ActiveQuery
     * 获取规则
     */
    public function getRule()
    {
        return $this->hasOne(WechatReplyRule::className(),['id'=>'rid']);
    }


    /**
     * @return \yii\db\ActiveQuery
     * 获取关键字
     */
    public function getkeyword()
    {
        return $this->hasOne(WechatReplyKeyword::className(),['rid'=>'rid']);
    }

}
